package com.leff.cards;

import android.app.Application;
import android.content.pm.PackageInfo;
import android.util.Log;

import com.leff.cards.data.AppState;
import com.leff.cards.util.Secrets;
import com.leff.cards.util.Settings;
import com.leff.notifications.NotificationCenter;
import com.leff.notifications.NotificationLogger;

public class CardsApplication extends Application implements Secrets {
	private static int mVersionCode;
	
	public static int getVersionCode() {
		return mVersionCode;
	}
	
	@Override
	public void onCreate() {
		super.onCreate();
		
		NotificationCenter.init(new NotificationLogger() {
			@Override
			public void logMessage(String message) {
//				Log.v(TAG, message);
			}
		});
	    try {
	    	Settings.init(this);
	    	
	    	PackageInfo info = getPackageManager().getPackageInfo(this.getPackageName(), 0);
	    	mVersionCode = info.versionCode;
	    } catch(Exception e) {
	    	mVersionCode = 0;
	    }
		AppState.get();
		
		Log.v(TAG, "CardsApplication initialized");
	}
}
